import moment from 'moment'

const pattern = 'YYYY-MM-DD HH:mm:ss'

export const getNow = () => {
  return moment(new Date()).format(pattern)
}

export const getFirstTimeOfYear = (year = (new Date()).getFullYear()) => {
  let dateStr = year + '-01-01 00:00:00'
  return moment(new Date(dateStr)).format(pattern)
}

export const getFormatTime = (time, pat) => {
  return moment(time).format(pat)
}